package com.arcaneshift.servlet.util.network;

import com.common.model.interfaces.IRequestAction;


/**
 * This class contains all the available actions for the project.
 * 
 * @author Ady
 *
 */
public enum RequestAction implements IRequestAction {
	LOGIN, LOGOUT, ADD_USER,
	GET_ALL_QUEUE_PLAYERS, GET_ALL_GAMES,
	LEAVE_QUEUE_PLAYER, REGISTER_QUEUE_PLAYER, GET_QUEUE_PLAYER_GAME, GET_START_GAME_STATS, PLAYER_READY, GAME_UPDATE,
	ADD_CREATURE_CARD, ADD_SPELL_CARD, ADD_DECK,
	SUMMON_CREATURE_CARD;
	
	public static IRequestAction contains(String action) {
		for (RequestAction requestAction : values()) {
			if (requestAction.equals(action)) {
				return requestAction;
			}
		}
		
		return null;
	}
	
	public boolean equals(String action) {
		action = action.replace(" ", "_");
		return this.toString().equalsIgnoreCase(action);
	}
}